<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<meta http-equiv="Content-Type" content="text/html;" charset="<?php echo CHARSET;?>">
<title>本地生活</title>
<link href="/Public/admin/css/skin_0.css" rel="stylesheet" type="text/css" id="cssfile"/>
<script type="text/javascript" src="/Public/static/jquery.js"></script>
<script type="text/javascript" src="/Public/static/jquery.validation.min.js"></script>
<script type="text/javascript" src="/Public/admin/js/jquery.cookie.js"></script>
<script type="text/javascript" src="/Public/admin/js/admincp.js"></script>
<script type="text/javascript" src="/Public/admin/js/jquery.tooltip.js"></script>
<script language="javascript">
var SiteUrl = '<?php echo (C("SiteUrl")); ?>';
var AdminUrl = SiteUrl+'/<?php echo (MODULE_NAME); ?>';
</script>
</head><body>
<script type="text/javascript">
function submit_delete_batch(){
    /* 获取选中的项 */
    var items = '';
    $('.checkitem:checked').each(function(){
        items += this.value + ',';
    });
    if(items != '') {
        items = items.substr(0, (items.length - 1));
        submit_delete(items);
    } else {
        alert('请选择要操作的对象');
    }
}

function submit_delete(id){
    if(confirm('确定要删除？')) {        
        $('#goods_id').val(id);
        $('#list_form').submit();
    }
}
</script>
<div class="page">
  <div class="fixed-bar">
    <div class="item-title">
      <h3>商品管理</h3>
      <ul class="tab-base">
        <li><a href="javascript:void(0);" class="current"><span>管理</span></a></li>
        <li><a href="<?php echo U('Goods/goods_add');?>"><span>新增</span></a></li>
      </ul>
    </div>
  </div>
  <div class="fixed-empty"></div>
  <form method="get" name="formSearch">
    <table class="tb-type1 noborder search">
      <tbody>
        <tr>
          <th>商品名称</th>
          <td><input type="text" value="<?php echo ($search['goods_name']); ?>" name="goods_name" class="txt" ></td>
          <th>所属分类</th>
          <td>
			  <select name="gc_id" id="gc_id" class="">
              <option value="">请选择...</option>
			  <?php if(is_array($class_list)): $i = 0; $__LIST__ = $class_list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><option <?php if($search['gc_id'] == $vo['gc_id']): ?>selected='selected'<?php endif; ?> value="<?php echo ($vo['gc_id']); ?>"><?php echo ($vo['gc_name']); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>	
            </select>          
          </td>
          <td><a href="javascript:document.formSearch.submit();" class="btn-search tooltip" title="查询">&nbsp;</a></td>
        </tr>
      </tbody>
    </table>
  </form>
  <!-- 操作说明 -->
  <table class="table tb-type2" id="prompt">
    <tbody>
      <tr class="space odd">
        <th colspan="12" class="nobg"><div class="title">
            <h5>操作提示</h5>
            <span class="arrow"></span></div></th>
      </tr>
      <tr>
        <td>
        	<ul>
            	<li>可以查看发布的产品，可以对产品进行删除等操作</li>
            	<li>显示产品名称、所属类别、商品价格、添加时间等</li>
          	</ul>
        </td>
      </tr>
    </tbody>
  </table>
  <form id="list_form" method='post' action="<?php echo U('Goods/goods_del');?>">
    <input id="goods_id" name="goods_id" type="hidden" />
    <table class="table tb-type2">
      <thead>
        <tr class="space">
          <th colspan="15" class="nobg">列表</th>
        </tr>
        <tr class="thead">
          <th class="w24"></th>
          <th class="w72">排序</th>
          <th colspan="2">商品名称</th>
          <th class="align-center">所属分类</th>
		  <th class="align-center">价格</th>
          <!--<th class="align-center">库存</th>-->
		  <th class="align-center">添加时间</th>
          <th class="w48 align-center">操作</th>
        </tr>
      </thead>
      <tbody>
        <?php if(!empty($list)): if(is_array($list)): $i = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$val): $mod = ($i % 2 );++$i;?><tr class="hover edit">
		  <td><input type="checkbox" value="<?php echo ($val['goods_id']); ?>" class="checkitem"></td>
          <td class="w48 sort"><span title="可编辑" ajax_branch="goods_sort" datatype="number" fieldid="<?php echo ($val['goods_id']); ?>" ajax_control="Goods" fieldname="goods_sort" nc_type="inline_edit" class="editable tooltip"><?php echo ($val['goods_sort']); ?></span></td>
          <td class="w60 picture">
          	<div class="size-56x56"><span class="thumb size-56x56"><i></i><img src="/Uploads/<?php echo ($val['goods_pic']); ?>" width="56" height="56"/></span></div>
          </td>
          <td class="goods-name w270">
          	<p><span class="editable-tarea tooltip"><?php echo ($val['goods_name']); ?></span></p>
          </td>
		  <td class="align-center"><?php echo ($val['GoodsClass']['gc_name']); ?></td>
		  <td class="align-center"><?php echo ($val['goods_price']); ?></td>
          <!--<td class="align-center"><?php echo ($val['goods_storage']); ?></td>-->
		  <td class="align-center"><?php echo (date('Y-m-d H:i:s',$val['add_time'])); ?></td>
		  <td class='w72 align-center'>
		  <a href="<?php echo U('Goods/goods_edit',array('goods_id'=>$val['goods_id']));?>">编辑</a> | <a href='javascript:if(confirm("确定要删除？"))window.location = "<?php echo U('Goods/goods_del',array('goods_id'=>$val['goods_id']));?>";'>删除</a>
		  </td>
        </tr><?php endforeach; endif; else: echo "" ;endif; ?>
        <?php else: ?>
        <tr class="no_data">
          <td colspan="10">暂无记录</td>
        </tr><?php endif; ?>
      </tbody>
      <?php if(!empty($list)): ?><tfoot>
        <tr class="tfoot">
          <td><input type="checkbox" class="checkall" id="checkall_1"></td>
          <td id="batchAction" colspan="15">
          	<span class="all_checkbox">
            	<label for="checkall_1">全选</label>
            	<a href="javascript:void(0)" class="btn" onclick="submit_delete_batch();"><span>删除</span></a>
            </span>
            <div class="pagination"><?php echo ($page_show); ?></div>
        </tr>
      </tfoot><?php endif; ?>
    </table>
  </form>
</div>
<script type="text/javascript" src="/Public/admin/js/jquery.edit.js" charset="utf-8"></script> 
</body></html>